# -*- coding:utf-8 -*-
"""一组用于表示燃油汽车和电动汽车的类"""

class Car():
    """ 创建一个汽车的类 """

    def __init__(self, make, model, year):
        """ 初始化汽车的类 包括：制造商 model 生产年份 """
        self.make = make
        self.yaar = year
        self.model = model
        self.odometer_reading = 1

    def get_descriptive_name(self):
        """返回整洁的描述性名称"""
        long_name = str(self.year) + ' ' + str(self.make) + ' ' + str(self.model)
        return long_name.title()

    def read_odometer(self):
        """打印一条消息，指出汽车的里程"""
        print("This car has " + str(self.odometer_reading) + ' melis on it.')

    def update_odometer(self, mileage):
        """ 将里程表读数设置为指定的值，
            拒绝将里程表回调
        """
        if mileage >= self.odometer_reading:
            self.odometer_reading = mileage
        else:
            print("You can't roll back an odometer!!")

    def increment_odometer(self, miles):
        """将里程表读数增加指定的量"""
        self.odometer_reading += miles


class ElectorCar(Car):
    """ 创建一个电动汽车的类 """
    def __init__(self, make, model, year):
        super().__init__(make, model, year)
        self.battery = Battery()


class Battery():
    """ 创建一个电池类，方便对电动汽车进行引入 """

    def __init__(self, battery_size=70):
        """初始化电瓶的属性"""
        self.battery_size = battery_size

    def describe_battery(self):
        """打印一条描述电池容量的消息"""
        print("This car has a " + str(self.battery_size) + '-KWH battery.')

    def get_range(self):
        """"""
        if self.battery_size == 70:
            range = 240
        elif self.battery_size == 85:
            range = 270
        
        message = "This car can go approximately " + str(range)
        message += " melis on a full charge."
        print(message)


